package com.pcdandan.pcdandan.processor;

import com.github.pagehelper.util.StringUtil;
import com.pcdandan.pcdandan.config.token.PcdandanTicket;
import com.pcdandan.pcdandan.service.PcdandanService;
import com.xiaoleilu.hutool.util.StrUtil;
import com.youyu.financial.gjj.crawler.annotation.Process;
import com.youyu.financial.gjj.crawler.executor.Context;
import com.youyu.financial.gjj.crawler.processor.PageProcessor;
import com.youyu.financial.gjj.crawler.visitor.Visitor;
import com.youyu.financial.gjj.crawler.visitor.http.HttpRequest;

@Process(method = "login", domain = "pcdandan")
public class PcdandanLoginProcessor implements PageProcessor {
	
	private String index = "http://www.pceggs.com/nologin.aspx";

	@Override
	public Boolean process(Visitor visitor, Context context) {
		PcdandanTicket ticket = (PcdandanTicket) context.getTicket();
		if(StrUtil.isNotEmpty(ticket.getLoginSession())) {
			PcdandanService.session = ticket.getLoginSession();
			return true;
		}
		//String indexHtml = visitor.visit(HttpRequest.newBuilder().get(index).build()).page().html();
		return false;
	}

}
